<template>
  <div class="indexContainer">
    <div class="indexBusiness">
      <div class="indexTitle">
        <div class="titleBig">
          <img src="@/assets/img/label.png" alt="">
          <h2>成果推荐</h2>
        </div>
      </div>
      <el-row :gutter="10">
        <el-empty :image-size="100" v-if="listData.length==0"  description="暂无数据"></el-empty>
        <el-col :xs="24" :sm="24" :md="12" :lg="6" :xl="6" v-for="item in listData" :key="item.id">
          <div class="proItem" @click="handleProDetail(item.id)">
            <div class="itemTop">
              <div class="topLeft">
                <img src="@/assets/img/icon.png" alt="">
                <h2 class="fontColor singleLine">{{item.title}}</h2>
              </div>
              <p class="topRight">
                <i class="el-icon-arrow-right"></i>
              </p>
            </div>
            <p class="proDesc fontColor moreLineFour">
              {{item.description}}</p>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
import {getAchievement} from "@/request/api/index"
export default {
  components: {

  },
  data() {
    return {
      params:{
        isRecommend:'1',//是否推荐1是2否
        current:1,
        pageSize:4
      },
      listData:[],
      userId:''
    }
  },
  created() {
    this.achievement()
    if (window.sessionStorage.getItem("userInfo") !== null) {
      let userInfo = JSON.parse(window.sessionStorage.getItem("userInfo"));
      this.userId = userInfo.id
    }
  },
  computed: {

  },
  methods: {
    // 获取成果
    achievement() {
      getAchievement(this.params).then(res => {
        if (res.data.code == 1) {
          this.listData = res.data.data.totalList
        }
      })
    },
    // 成果推荐产品详情
    handleProDetail(id) {
      this.$router.push({
        name: "ExchangeResultsDetail",
        query: {
          id,
          userId: this.userId
        }
      });
    }
  }
}
</script>
<style lang="less" scoped>@import "./collaboration.less";
@import "../common.less";</style>